<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>网站后台管理模版</title>
		<link rel="stylesheet" href="lib/layui-v2.5.5/css/layui.css" media="all">
		<link rel="stylesheet" href="css/public.css" media="all">
	</head>
	<body>

		<form class="layui-form layui-from-pane" action="" style="margin-top:20px" lay-filter="formMenu">

	<div>
		<p style="color:red;">标题:</p>
		<h2 class="zx-title"></h2>
		<hr/>
		<div>
			<span class="type"></span>
			<span class="readNum">0</span>阅读
			<span class="publictime"></span>
			<span class="commentNum">0</span>条评论
			<span class="collectNum">0</span>人收藏
		</div>
		<hr/>
		<p style="color:red;">内容:</p>
		<textarea id="content" style="display:none" readonly>

		</textarea>
		<hr/>
		<p style="color:red;">评论:</p>
		<div class="comments">

		</div>
	</div>



<script src="lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="api/baseApi.js" charset="utf-8"></script>
<script>
		layui.use(['layer','layedit'], function(){
			var layer = layui.layer;
			var $ = layui.$;
			var layedit = layui.layedit;
			//获取页面传过来的数据
			let localData = layui.sessionData("zxData");

			let zxId = localData.zx.id;

			$.ajax({
				url: baseUrl + zxBaseUrl + zxId ,
				type: 'get' ,
				dataType: "json",
				contentType: "application/json;charset=UTF-8",
				success:function (res) {

					console.log(res);
					let zx = res.data.zxArticle;
					let comments = res.data.comments;
					$('.zx-title').html(zx.title);
					$('.type').text(zx.name);
					$('.readNum').text(zx.readNum);
					$('.publictime').text(zx.publictime);
					$('.commentNum').text(zx.commentNum);
					$('.collectNum').text(zx.collectNum);
					$('#content').html(zx.content);
					console.log(zx.content);
					console.log($('.content').val())
					var index = layedit.build('content',{
						height:300
					}); //建立编辑器
				}
			})

		});
</script>
</body>
</html>